package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchInstantaneousFlowAverageReports;
import com.ruoyi.system.service.IDispatchInstantaneousFlowAverageReportsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 瞬时流量均值报Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchInstantaneousFlowAverageReports")
public class DispatchInstantaneousFlowAverageReportsController extends BaseController
{
    @Autowired
    private IDispatchInstantaneousFlowAverageReportsService dispatchInstantaneousFlowAverageReportsService;

    /**
     * 查询瞬时流量均值报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchInstantaneousFlowAverageReports dispatchInstantaneousFlowAverageReports)
    {
        startPage();
        List<DispatchInstantaneousFlowAverageReports> list = dispatchInstantaneousFlowAverageReportsService.selectDispatchInstantaneousFlowAverageReportsList(dispatchInstantaneousFlowAverageReports);
        return getDataTable(list);
    }

    /**
     * 导出瞬时流量均值报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:export')")
    @Log(title = "瞬时流量均值报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchInstantaneousFlowAverageReports dispatchInstantaneousFlowAverageReports)
    {
        List<DispatchInstantaneousFlowAverageReports> list = dispatchInstantaneousFlowAverageReportsService.selectDispatchInstantaneousFlowAverageReportsList(dispatchInstantaneousFlowAverageReports);
        ExcelUtil<DispatchInstantaneousFlowAverageReports> util = new ExcelUtil<DispatchInstantaneousFlowAverageReports>(DispatchInstantaneousFlowAverageReports.class);
        util.exportExcel(response, list, "瞬时流量均值报数据");
    }

    /**
     * 获取瞬时流量均值报详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:query')")
    @GetMapping(value = "/{instantaneousFlowAverageReportsId}")
    public AjaxResult getInfo(@PathVariable("instantaneousFlowAverageReportsId") Long instantaneousFlowAverageReportsId)
    {
        return success(dispatchInstantaneousFlowAverageReportsService.selectDispatchInstantaneousFlowAverageReportsByInstantaneousFlowAverageReportsId(instantaneousFlowAverageReportsId));
    }

    /**
     * 新增瞬时流量均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:add')")
    @Log(title = "瞬时流量均值报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchInstantaneousFlowAverageReports dispatchInstantaneousFlowAverageReports)
    {
        return toAjax(dispatchInstantaneousFlowAverageReportsService.insertDispatchInstantaneousFlowAverageReports(dispatchInstantaneousFlowAverageReports));
    }

    /**
     * 修改瞬时流量均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:edit')")
    @Log(title = "瞬时流量均值报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchInstantaneousFlowAverageReports dispatchInstantaneousFlowAverageReports)
    {
        return toAjax(dispatchInstantaneousFlowAverageReportsService.updateDispatchInstantaneousFlowAverageReports(dispatchInstantaneousFlowAverageReports));
    }

    /**
     * 删除瞬时流量均值报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchInstantaneousFlowAverageReports:remove')")
    @Log(title = "瞬时流量均值报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{instantaneousFlowAverageReportsIds}")
    public AjaxResult remove(@PathVariable Long[] instantaneousFlowAverageReportsIds)
    {
        return toAjax(dispatchInstantaneousFlowAverageReportsService.deleteDispatchInstantaneousFlowAverageReportsByInstantaneousFlowAverageReportsIds(instantaneousFlowAverageReportsIds));
    }
}
